package cn.cdeden.knowledge.domain;

import cn.cdeden.knowledge.domain.dto.CommonModel;
import cn.cdeden.knowledge.domain.dto.SysResourceDto;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
//import io.swagger.annotations.ApiModelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
* @author guojunxu
* @date 2024-07-09
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@AutoMappers({@AutoMapper(target = SysResourceDto.class)})
@TableName("sys_resource")
public class SysResource extends CommonModel<SysResource> implements Serializable {
    private static final long serialVersionUID = 1L;

//    @ApiModelProperty(value = "主键ID")
    @TableId(type= IdType.AUTO)
    private Long resourceId;

//    @ApiModelProperty(value = "资源名称")
    @NotBlank
    private String resourceName;

//    @ApiModelProperty(value = "资源描述")
    private String resourceDescribe;

//    @ApiModelProperty(value = "资源类型")
    @NotNull
    private Long resourceType;

//    @ApiModelProperty(value = "[默认1：启用 0：禁用]")
    @NotNull
    private Integer resourceFlag;

//    @ApiModelProperty(value = "创建时间")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

//    @ApiModelProperty(value = "创建人")
    @TableField(fill= FieldFill.INSERT)
    private Long createBy;

    public void copyFrom(SysResource source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
